<?php
class Jextn_Testimonials_Block_Testimonials extends Mage_Core_Block_Template
{
	public function _prepareLayout()
    {
		//$this->getLayout()->getBlock('head')->setTitle(Mage::helper('testimonials')->getTestimonialsTitle());
		return parent::_prepareLayout();
    }
    
    public function getTestimonials()     
     { 
         
		
	   $page = $this->getRequest()->getParam('page'); 
        $collection = Mage::getModel('testimonials/testimonials')->getCollection()
            ->addIsActiveFilter();
       $collection->setOrder('created_time','DESC');
       $toolbar = $this->getLayout()->createBlock('page/html_pager');
       //$toolbar->setAvailableOrders(array('created_time'=>'Submit Time'));
      // $toolbar->setDefaultOrder('asc');
       $toolbar->setCollection($collection);
       $this->setChild('toolbar_testimonials',$toolbar); 
        return $collection;        
    }
    public function getToolbarHtml(){
    
        return $this->getChild('toolbar_testimonials')->toHtml();
    
    }	
	public function getSidebarTestimonials()     
     { 
		$collection = Mage::getModel('testimonials/testimonials')->getCollection()
							->addSidebarFilter()
							->addIsActiveFilter();
        return $collection;        
    }
	
	public function getFormAction()
	{
		return $this->getUrl('testimonials/submit/post', array('_secure' => true));	
	}
}
